package com.ljx.rabbit.config;

import com.ljx.rabbit.interceptor.JwtInterceptor;
import com.ljx.rabbit.properties.JwtProperty;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
@RequiredArgsConstructor
@Slf4j
public class MVCConfig implements WebMvcConfigurer {
    private final JwtInterceptor jwtInterceptor;


    /**
     * 注册自定义拦截器
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        log.info("开始注册自定义拦截器...");
        registry.addInterceptor(jwtInterceptor)
                .addPathPatterns("/member/**","/user/info","/goods/relevant","/goods/comment/**","/user/likes")
                .excludePathPatterns("/user/login","/user/register","/home/**","/goods","/goods.hot","/category/**");
    }
}
